// $Id$
// vim:ft=javascript noet ts=4 sts=4 sw=4

ARG_WITH('ev', 'for ev support', 'no');
ARG_ENABLE('ev_debug', 'for ev debug support', 'no');

if (PHP_EV != 'no') {
	if (CHECK_HEADER_ADD_INCLUDE('ev.h', 'CFLAGS_EV', configure_module_dirname + '\\libev;' + PHP_EV)) {
		var dll = get_define('PHPDLL');
		var php_ev_sources = 'evwrap.c util.c ev.c watcher.c pe.c';
		AC_DEFINE('HAVE_EV', 1);
		ADD_FLAG('CFLAGS_EV', '/D _WIN32');

		ADD_EXTENSION_DEP('ev', 'sockets', true);

		if (PHP_EV_DEBUG != 'no') {
			ADD_FLAG('CFLAGS_EV', '/D PHP_EV_DEBUG=1');
		} else {
			ADD_FLAG('CFLAGS_EV', '/D NDEBUG');
		}

		EXTENSION('ev', php_ev_sources, true, ' /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
		CHECK_HEADER_ADD_INCLUDE('embed.h', 'CFLAGS_EV', configure_module_dirname);
		//ADD_SOURCES(configure_module_dirname, 'evwrap.c', 'ev');
	} else {
		WARNING('ev not enabled; libraries and headers not found');
	}
}
